<?php
/**
* test widget
*/
class classWidget extends CWidget
{    
    public function init()
    {
        //当视图中执行$this->beginWidget()时候会执行这个方法
        //可以在这里进行查询数据操作
    }
 
    public function run()
    {
        $condition = new CDbCriteria();
        $condition->order = 'hot desc';
        $classes = ProductClass::model()->findAll($condition);
        unset($condition);        
        $this->render('class',array(
            'classes' => $classes,
        ));
    }
}
?>